import { basicProps } from '@/components/Table/src/props';
import { BasicColumn } from '@/components/Table';

import { PageRequest, PageData, FilterGroup } from '#/request';
import { propTypes } from '@/utils/propTypes';

import { AdColumn } from './types/adTable';
import type { AdDetailFormProps } from './types/adDetailForm';

export const adTableProps = {
  ...basicProps,
  /** 表格数据接口请求对象 */
  api: {
    type: Function as PropType<(params: PageRequest) => Promise<PageData | any>>,
    default: null,
  },
  /** 额外的请求参数 */
  searchInfo: {
    type: Object as PropType<FilterGroup>,
    default: null,
  },
  /** 列配置 */
  columns: {
    type: Array as PropType<AdColumn[]>,
    default: () => [],
  },
  /** 序号列配置 */
  indexColumnProps: {
    type: Object as PropType<BasicColumn>,
    default: null,
  },
  /** 操作列配置 */
  actionColumn: {
    type: Object as PropType<BasicColumn>,
    default: null,
  },
  /** 在INPUT组件上单击回车时，是否自动提交 */
  searchFormAutoSubmitOnEnter: propTypes.bool.def(true),
  /** 是否在重置时重新发起请求 */
  searchFormSubmitOnReset: propTypes.bool.def(true),
  /** 详情表单 */
  detailForm: {
    type: Object as PropType<AdDetailFormProps>,
    default: null,
  },
};
